function addCustomer() {
    Ajax.getHtml('so/customerAdd.html', function (html) {
        layer.open({
            type: 1,
            title: '新增客户',
            area: ['600px'],
            content: html,
            btn: ['确认', '取消'],
            yes: function () {
                saveCustomer()
            },
            btn2: function () {
                console.log('取消新增客户')
            }
        })
    })
}

function saveCustomer() {
    Ajax.post(
        '/addCustomer',
        {
            customerCode:$("#customerCode").val(),
            name:$("#customerName").val(),
            password:$("#password").val(),
            contactor:$("#contactor").val(),
            address:$("#address").val(),
            postCode:$("#postcode").val(),
            tel:$("#tel").val(),
            fax:$("#fax").val()
        },
        function (result) {
            doResult(result, function () {
                layer.closeAll()
                show('so/customer.html')
                layer.alert(result.msg)
            })
        }
    )
}
function updateCustomer() {
    Ajax.post(
        '/updateCustomer',
        {
            customerCode:$("#customerCode").val(),
            name:$("#customerName").val(),
            password:$("#password").val(),
            contactor:$("#contactor").val(),
            address:$("#address").val(),
            postCode:$("#postcode").val(),
            tel:$("#tel").val(),
            fax:$("#fax").val()
        },
        function (result) {
            doResult(result, function () {
                layer.closeAll()
                show('so/customer.html')
                layer.alert(result.msg)
            })
        }
    )
}
